<?php
namespace app\admin\controller;
use think\Db;
class register extends Common
{

    //首页预约展示
    public function index()
    {
        $phone=input('phone')?input('phone'):'';
        $babyname=input('babyname')?input('babyname'):'';
        $where="id>0";
        if($phone){
            $where.=" and phone like '%$phone%'";
        }

        if($babyname){
            $where.=" and babyname like '%$babyname%'";
        }

        $registers=DB::name('register')->where($where)->select();
        foreach($registers as $key=>$value)
        {
            $registers[$key]['addtime']=date('Y-m-d H:i',$value['addtime']);
            $registers[$key]['sex']=$this->getsex($value['sex']);
        }
        $this->assign('registers',$registers);
        $this->assign('phone',$phone);
        $this->assign('babyname',$babyname);
        return $this->fetch();
    }

}
